import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { LayoutRourteStatus } from 'src/app/model/status';
import { MessageService } from 'src/app/core/service';
import { MemberService } from '../../member.server';

@Component({
    selector: 'app-message-dtl',
    templateUrl: './message-dtl.html',
    styleUrls: ['./message-dtl.scss']
})
export class MessageDtlComponent implements OnInit {
    private _layoutRourteStatus: LayoutRourteStatus = {
        url: '/member/center/transactionListPage',
        isHiddeBreadcrumb: false,
        breadcrumbs: [{ tragetTitle: '交易订单', breadcrumbUrl: '/member/center/transactionListPage' }, { tragetTitle: '订单详情' }]
    };
    private _data = {};

    ngOnInit() {
        this.msg.sendLayoutRourteStatus(this._layoutRourteStatus);
        this.loadList('交易订单详情');
    }

    async loadList(url) {
        const data = await this.memberServer.getAJX(url, this._aroute.snapshot.queryParams);
        this.memberServer.getApiSuccess(data, false) ? this.successListOk(data.data, url) : '';
    }

    public successListOk(data, url): void {
        switch (url) {
            case '交易订单详情':
                this._data = data.tradeOrder;
                break;
        }
    }

    constructor(private memberServer: MemberService, private _aroute: ActivatedRoute, private msg: MessageService) {}
}
